#coding=utf-8

import urllib,urllib2,json

def post(url,data=None,header=None):
	req = urllib2.Request(url,data,header)
	try:
		res = urllib2.urlopen(req)
		print res.getcode()
		print res.read()
	except urllib2.HTTPError,e:
		print e.code,e.read()
	except urllib2.URLError,e:
		print e.args,e.reason

def put(url,data=None,header = None):
	req = urllib2.Request(url,data,header)
	req.get_method = lambda: 'PUT'
	try:
		res = urllib2.urlopen(req)
		print res.getcode()
		print res.read()
	except urllib2.HTTPError,e:
		print e.code,e.read()
	except urllib2.URLError,e:
		print e.args,e.reason
	

